typedef struct ListNode ListNode;
struct ListNode *detectCycle(struct ListNode *head)
{
    ListNode* fast = head, *slow = head;
    while(fast && fast->next)
    {
        fast = fast->next->next;
        slow = slow->next;
        if(fast == slow)
        {
            ListNode* meet = fast;
            ListNode* pcur = head;
            while(pcur != meet)
            {
                pcur = pcur->next;
                meet = meet->next;
            }
            return pcur;
        }
    }
    return NULL;
}